<template>
	<view class="content">
		<view class='headerTop'>
			<view class='uniBar'>库存报表</view>
<!-- 			<view class='select' @click="toggle('bottom')">
				<image src="../../static/screen.png"></image>
				<view>筛选</view>
			</view> -->
		</view>



		<view class='context'>
					<view v-for="(item,index) in list">
		
						<uni-card :title="item.name" :extra="item.extra" @click="toList(item)">
							<view class='main'>
								<view>序号：<span>{{item.id}}</span></view>
								<view>创建时间：<span>{{item.createTime}}</span></view>
							</view>
						</uni-card>
					</view>
				</view>
		
				<view>
					<!-- 普通弹窗 -->
					<uni-popup ref="popup" background-color="#fff" @change='blur'>
						<view class="popup-content">
							<view class='top'>筛选</view>
							<view class='proBox'>
								<view>工程</view>
								<view class="proStyle">
									<view v-for="(item,index) in list" class='titlebtn'>
										<button>{{item.title}}</button>
									</view>
								</view>
		
							</view>
		
							<view>时间</view>
							<view class="timeCss">
								<view v-for="(item2,index2) in time" class='timebtn'>
									<button>{{item2}}</button>
								</view>
							</view>
		
		
							<view class='date'>
								<uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick"
									class='one' placeholder='开始时间' />
								<span class="line"></span>
								<uni-datetime-picker type="date" :clear-icon="false" v-model="single2" @maskClick="maskClick"
									class='two' placeholder='结束时间' />
							</view>
		
							<view class='handle'>
								<button class='cancle'>重置</button>
								<button class='save'>确定</button>
							</view>
						</view>
					</uni-popup>
				</view>
		
			</view>
		</template>
		
		<script>
			export default {
				data() {
					return {
						title: 'Hello',
						list: [{
								title: '某某某某工程',
								extra: '查看明细',
								num: '01',
								address: '山东省枣庄市某某某某某某',
								time: '2022-02-02 12:00:00'
							},
							{
								title: '某某某某工程',
								extra: '查看明细',
								num: '01',
								address: '山东省枣庄市某某某某某某',
								time: '2022-02-02 12:00:00'
							},
							{
								title: '某某某某工程',
								extra: '查看明细',
								num: '01',
								address: '山东省枣庄市某某某某某某',
								time: '2022-02-02 12:00:00'
							},
							{
								title: '某某某某工程',
								extra: '查看明细',
								num: '01',
								address: '山东省枣庄市某某某某某某',
								time: '2022-02-02 12:00:00'
							},
							{
								title: '某某某某工程',
								extra: '查看明细',
								num: '01',
								address: '山东省枣庄市某某某某某某',
								time: '2022-02-02 12:00:00'
							},
							{
								title: '某某某某工程',
								extra: '查看明细',
								num: '01',
								address: '山东省枣庄市某某某某某某',
								time: '2022-02-02 12:00:00'
							},
							{
								title: '某某某某工程',
								extra: '查看明细',
								num: '01',
								address: '山东省枣庄市某某某某某某',
								time: '2022-02-02 12:00:00'
							},
							{
								title: '某某某某工程',
								extra: '查看明细',
								num: '01',
								address: '山东省枣庄市某某某某某某',
								time: '2022-02-02 12:00:00'
							},
						],
						time: ['今天', '昨天', '本周', '上周', '本月', '上月', '本季度', '上季度', '去年', '今年', '自定义'],
						datetimerange: [],
						single: '',
						single2: '',
					}
				},
				onLoad() {
					this.getNew2()
					// uni.request({
					//     url:"http://127.0.0.1:8000/app/user/",
					//     data: {
					//         text: 'uni.request'
					//     },
					//     header: {
					// 		'content-type':'application/json'
					//     },
					//     success: (res) => {
					//         console.log(res.data);
					// 		this.list=res.data.list
					//         this.text = 'request success';
					//     }
					// });
				},
				methods: {
					back() {
						uni.navigateBack({
							delta: 1,
							type: 'center',
						})
					},
					toggle(type) {
						this.type = type
						// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
						this.$refs.popup.open(type)
						uni.hideTabBar({})
					},
					blur() {
						uni.showTabBar({})
					},
					maskClick(e) {
						console.log('maskClick事件:', e);
					},
					toList(item) {
						uni.navigateTo({
							url: '/pages/list1/list1?project_id='+item.id+'&project_name='+item.name
						});
					},
					getNew2() {
						uni.request({
							url: 'project', //仅为示例，并非真实接口地址。
							method: "get",
							// header:{token:uni.getStorageSync('token')},
							header: {
								"Authorization": "Bearer" + " " + 'miniproject'
							},
							data: {
		
							},
							success: (res) => {
								this.list = res.data.data
								// console.log(actions.value);
							}
						})
					},
					//获取到相应的token
					getToken() {
						uni.request({
							url: 'login', //仅为示例，并非真实接口地址。
							method: "post",
							header: {
		
							},
							data: {
								phone: "13012345678",
								password: "123"
							},
							success: (res) => {
								uni.setStorageSync('token', res.data.token);
								this.getNew2()
							}
						})
					}
				},
				
			}
		</script>
		
		<style scoped lang="less">
			.content {
				height: 100%;
				width: 100%;
			}
		
			.headerTop {
				width: 100%;
				height: 25vh;
				background-color: rgb(36, 120, 242);
				border-bottom-right-radius: 10px;
				border-bottom-left-radius: 10px;
		
				.uniBar {
					color: #fff;
					font-size: 46rpx;
					text-align: center;
					padding: 90rpx 0 60rpx;
				}
		
				.select {
					display: flex;
					color: #fff;
					justify-content: flex-end;
					font-size: 24rpx;
					padding-right: 30rpx;
					padding-bottom: 20rpx;
				}
		
				.select image {
					width: 30rpx;
					height: 30rpx;
					margin-right: 15rpx;
				}
			}
		
			/deep/ .uni-navbar__header {
				/* border-bottom-right-radius: 20px;- */
				border-radius: 50% !important;
			}
		
		
		
			.logo {
				height: 200rpx;
				width: 200rpx;
				margin-top: 200rpx;
				margin-left: auto;
				margin-right: auto;
				margin-bottom: 50rpx;
			}
		
			.text-area {
				display: flex;
				justify-content: center;
			}
		
			.title {
				font-size: 36rpx;
				color: #8f8f94;
			}
		
			.uni-card {
				width: 100%;
				border-radius: 20rpx;
				padding: 0 !important;
				margin: 0 !important;
				margin-bottom: 20rpx !important;
			}
		
			.context {
				width: 100%;
				position: absolute;
				top: 240rpx;
				padding: 0 30rpx 60rpx;
				box-sizing: border-box;
		
				&>view {
					width: 100%;
				}
			}
		
			/deep/ .uni-card .uni-card__header .uni-card__header-content .uni-card__header-content-title[data-v-19622063] {
				color: #2b78f2;
				font-weight: bold;
			}
		
			/deep/ .uni-card .uni-card__header .uni-card__header-extra .uni-card__header-extra-text[data-v-19622063] {
				color: #056bde;
				border: 1px solid #056bde;
				font-size: 15rpx;
				padding: 5rpx 5rpx;
				letter-spacing: 3rpx;
				border-radius: 3px;
				font-weight: bold;
			}
		
			.main {
				color: #7a8f9c;
			}
		
			.main span {
				color: #333333;
			}
		
		
		
			.popup {
				height: 300rpx;
			}
		
			.popup-content {
				// display:  flex;
				// align-items: center;
				// justify-content: center;
				// padding: 15px;
				// height: 100%;
				// background-color: #fff;
			}
		
			.text {
				font-size: 12px;
				color: #333;
			}
		
			.top {
				text-align: center;
				font-weight: 600;
			}
		
		
			.proStyle {
				display: grid;
				grid-template-columns: repeat(3, 1fr);
				column-gap: 20rpx;
				row-gap: 30rpx;
				padding: 30rpx 0;
		
			}
		
			.titlebtn button {
				/* flex: 1; */
				font-size: 18rpx;
				height: 50rpx;
				line-height: 50rpx;
				border-radius: 50rpx;
				background-color: #eeeeee;
				color: #cecccc;
				font-weight: bold;
			}
		
			.titlebtn button:hover {
				background-color: #d6e9ff;
				color: #8581de;
			}
		
			.timeCss {
				display: grid;
				grid-template-columns: repeat(4, 1fr);
				column-gap: 60rpx;
				row-gap: 30rpx;
				padding: 30rpx 0;
		
			}
		
			.timebtn button {
				height: 50rpx;
				font-size: 18rpx;
				line-height: 50rpx;
				border-radius: 50rpx;
				background-color: #eeeeee;
				color: #cecccc;
				font-weight: bold;
				padding: 0 !important;
			}
		
		
			.timebtn button:hover {
				background-color: #d6e9ff;
				color: #8581de;
			}
		
			.handle {
				display: flex;
				font-weight: 500;
		
				button {
					width: 250rpx;
					height: 70rpx;
					line-height: 70rpx;
					border: 1px solid #5278f0;
					text-align: center;
					font-size: 28rpx;
				}
			}
		
			.cancle {
				background-color: #ffffff;
				color: #5278f0;
			}
		
			.save {
				background-color: #5278f0;
				color: #ffffff;
				border: 1px solid #ffffff;
			}
		
			.date {
				display: flex;
			}
		
			.one {
				width: 280rpx;
			}
		
			.two {
				width: 280rpx;
			}
		
			/deep/.uni-date-x[data-v-6e13d7e2] {
				height: 30px;
			}
		
			.line {
				display: inline-block;
				width: 100rpx;
				height: 3rpx;
				background-color: lightgray;
				position: relative;
				top: 30rpx;
				margin: 0 10rpx;
			}
		
			.handle {
				margin-top: 50rpx;
			}
		</style>
		